Joey Hess [Tue, 11 Feb 2025 17:54:17 +0000 (13:54 -0400)]
use to/fromOsPath
Just to reduce the number of from/toRawFilePath calls, which I would
like to minimize.
In this build path, the two are the same though.
Joey Hess [Tue, 11 Feb 2025 17:49:17 +0000 (13:49 -0400)]
remove unused functions from Utility.RawFilePath
Joey Hess [Tue, 11 Feb 2025 17:41:26 +0000 (13:41 -0400)]
replace removeLink with removeFile
same reasoning as in commit
5cc8d9d03b53f2e43d51e4f612f423178519e824
Joey Hess [Tue, 11 Feb 2025 17:01:13 +0000 (13:01 -0400)]
update todo
Joey Hess [Tue, 11 Feb 2025 16:46:14 +0000 (12:46 -0400)]
replace R.doesPathExist with doesPathExist
Equivilant, just avoids some ugliness.
Joey Hess [Tue, 11 Feb 2025 16:37:09 +0000 (12:37 -0400)]
test suite now passes after OsPath conversion
The test suite was failing because of a bug in the Database/* modules.
I had replaced doesPathExist with doesDirectoryExist, but it was
checking the database file.
I have audited commit
f1ba21d698c908ad84c08bce24fbbc376190fe83 for
other changes to doesPathExist, and checked that doesDirectoryExist and
doesFileExist were used correctly.
The only change I found is in youtubeDl', where it used to return
directories that might have been created by youtube-dl. But it was
supposed to return media files, so changing it to use doesFileExist is
actually an improvement. Although only of theoretical benefit.
Note that it would actually be possible to keep using doesPathExist,
there is a version of that for OsPath as well. But the rest of these
changes seem safe.
Sponsored-by: Nicholas Golder-Manning
Joey Hess [Tue, 11 Feb 2025 16:12:27 +0000 (12:12 -0400)]
OsPath conversion of linuxstandalone builder
Sponsored-by: Joshua Antonishen
Joey Hess [Mon, 10 Feb 2025 20:25:31 +0000 (16:25 -0400)]
OsPath build flag no longer depends on filepath-bytestring
However, filepath-bytestring is still in Setup-Depends.
That's because Utility.OsPath uses it when not built with OsPath.
It would be maybe possible to make Utility.OsPath fall back to using
filepath, and eliminate that dependency too, but it would mean either
wrapping all of System.FilePath's functions, or using `type OsPath = FilePath`
Annex.Import uses ifdefs to avoid converting back to FilePath when not
on windows. On windows it's a bit slower due to that conversion.
Utility.Path.Windows.convertToWindowsNativeNamespace got a bit
slower too, but not really worth optimising I think.
Note that importing Utility.FileSystemEncoding at the same time as
System.Posix.ByteString will result in conflicting definitions for
RawFilePath. filepath-bytestring avoids that by importing RawFilePath
from System.Posix.ByteString, but that's not possible in
Utility.FileSystemEncoding, since Setup-Depends does not include unix.
This turned out not to affect any code in git-annex though.
Sponsored-by: Leon Schuermann
Joey Hess [Mon, 10 Feb 2025 19:40:04 +0000 (15:40 -0400)]
merging the two lines of OsPath conversion commits
Joey Hess [Mon, 10 Feb 2025 19:24:28 +0000 (15:24 -0400)]
OsPath conversion
While some RawFilePath and FilePath remain, this converts most of
git-annex to using OsPath.
(When built without the OsPath build flag, is falls back to using
type OsPath = RawFilePath.)
The goals are
1) improved performance by using OsPath end-to-end when possible
2) potentially avoiding memory use problems caused by pinned strict
ByteString, since OsPath uses ShortByteString
3) eventually eliminating the filepath-bytestring dependency so I don't
need to keep maintaining that library
(this doesn't get all the way, but close)
4) generally improved type safety, since OsPath is a newtype, while
FilePath and RawFilePath are just type aliaes.
This is the result of a type checker driven process. I started by
converting from System.Directory to System.Directory.OsPath, and from
System.FilePath to System.OsPath. Then I fixed all the compile errors,
which took 3 weeks of work.
Unfortunately, there are several test suite failures at this point.
Also, it only has been built on linux, on windows and OSX there are
probably ifdefs whose code still needs to be converted.
Note that there is a parallel line of commits, starting with
05bdce328d890cbac68a8627aaae262078a8290a
which is the incremental progress as I worked on this. It will be merged
with this commit. In some cases, commits in that line explain in more
details the reasons for some specific changes.
Joey Hess [Mon, 10 Feb 2025 19:18:10 +0000 (15:18 -0400)]
fix reversions
Oops, in
0b9e9cbf70c6375c8ccccdfac95b5e04ca09f891 I lost takeDirectory
in several places.
With this fixed, the test suite no longer utterly blows up, but still
fails in 7 places due to other bugs introduced in the OsPath conversion.
Sponsored-by: Graham Spencer
Joey Hess [Mon, 10 Feb 2025 18:57:25 +0000 (14:57 -0400)]
more OsPath conversion (749/749)
Builds with and without OsPath build flag.
Unfortunately, the test suite fails.
Sponsored-by: unqueued on Patreon
Joey Hess [Mon, 10 Feb 2025 16:33:21 +0000 (12:33 -0400)]
don't export pack and unpack
These are too widly used for other things to make sense to export OsPath
versions of them. And OsString also provides them and gets imported
qualified when needed.
Joey Hess [Sat, 8 Feb 2025 19:17:33 +0000 (15:17 -0400)]
more OsPath conversion (658/749)
At this point the test suite builds, and mostly the assistant is left.
Sponsored-by: unqueued
Joey Hess [Fri, 7 Feb 2025 21:03:31 +0000 (17:03 -0400)]
more OsPath conversion (650/749)
Sponsored-by: Nicholas Golder-Manning
Joey Hess [Fri, 7 Feb 2025 20:07:05 +0000 (16:07 -0400)]
more OsPath conversion (639/749)
Sponsored-by: k0ld
Joey Hess [Fri, 7 Feb 2025 18:46:11 +0000 (14:46 -0400)]
more OsPath conversion (602/749)
Sponsored-by: Brock Spratlen
Joey Hess [Thu, 6 Feb 2025 20:18:52 +0000 (16:18 -0400)]
more OsPath conversion (572/749)
Sponsored-by: Jack Hill
Joey Hess [Thu, 6 Feb 2025 15:42:49 +0000 (11:42 -0400)]
Joey Hess [Thu, 6 Feb 2025 15:40:03 +0000 (11:40 -0400)]
update
Joey Hess [Thu, 6 Feb 2025 15:38:14 +0000 (11:38 -0400)]
more OsPath conversion (542/749)
Sponsored-by: Luke T. Shumaker
Joey Hess [Wed, 5 Feb 2025 19:07:59 +0000 (15:07 -0400)]
more OsPath conversion (520/749)
Sponsored-by: mycroft
Joey Hess [Wed, 5 Feb 2025 17:31:07 +0000 (13:31 -0400)]
Merge branch 'master' into ospath
Joey Hess [Wed, 5 Feb 2025 17:29:58 +0000 (13:29 -0400)]
more OsPath conversion (502/749)
Sponsored-by: Kevin Mueller on Patreon
Joey Hess [Wed, 5 Feb 2025 16:14:56 +0000 (12:14 -0400)]
more OsPath conversion (475/749)
Sponsored-by: Nicholas Golder-Manning
Joey Hess [Wed, 5 Feb 2025 15:56:26 +0000 (11:56 -0400)]
OsPath conversion of Annex.YouTubeDl
The change of R.doesPathExist to doesFileExist I think fixes a reversion
introduced in commit
1ceece3108f03badcca0d9c64cd287f9352656b3. Before
that commit, it was doesFileExist, and I assume to point is that this is
only supposed to return files, not any subdirectories that yt-dlp might
create while running.
Joey Hess [Wed, 5 Feb 2025 15:14:45 +0000 (11:14 -0400)]
OsPath conversion of Remote.Adb
Note that the additional use of System.FilePath.Posix likely fixes a
problem if this were used on windows. The AndroidPath uses / directory
separators. Before this, on windows, \ would have been used.
The change to newtype AndroidPath is only documentation.
Joey Hess [Tue, 4 Feb 2025 20:09:47 +0000 (16:09 -0400)]
more OsPath conversion
Sponsored-by: Leon Schuermann
Joey Hess [Tue, 4 Feb 2025 17:35:17 +0000 (13:35 -0400)]
more OsPath conversion (464/749)
Sponsored-by: unqueued
Joey Hess [Mon, 3 Feb 2025 19:16:42 +0000 (15:16 -0400)]
more OsPath conversion
Sponsored-by: Graham Spencer
Joey Hess [Sun, 2 Feb 2025 18:16:58 +0000 (14:16 -0400)]
replace removeLink with removeFile
removeFile calls unlink so removes anything not a directory. So these
are replaceable in order to convert to OsPath.
Joey Hess [Sun, 2 Feb 2025 18:03:43 +0000 (14:03 -0400)]
more OsPath conversion
Sponsored-by: Joshua Antonishen
Joey Hess [Sat, 1 Feb 2025 18:06:38 +0000 (14:06 -0400)]
more OsPath conversion
Sponsored-by: k0ld
Joey Hess [Sat, 1 Feb 2025 15:54:19 +0000 (11:54 -0400)]
more OsPath conversion
Sponsored-by: Brock Spratlen
Joey Hess [Thu, 30 Jan 2025 23:06:06 +0000 (19:06 -0400)]
move windows test suite workaround to relatedTemplate
Joey Hess [Thu, 30 Jan 2025 23:03:36 +0000 (19:03 -0400)]
Revert "add windows debug"
This reverts commit
76bfdf6a0348211ecfe934c93f6a1f08bd537660.
Joey Hess [Thu, 30 Jan 2025 21:45:34 +0000 (17:45 -0400)]
add windows debug
Joey Hess [Thu, 30 Jan 2025 21:43:38 +0000 (17:43 -0400)]
Revert "try truncateFilePath on windows again"
This reverts commit
0d4abbcb92ff40e90cbc44f3d1a42243bdbae2ba.
Test suite was failing again with that.
Joey Hess [Thu, 30 Jan 2025 21:06:22 +0000 (17:06 -0400)]
try truncateFilePath on windows again
after fix in commit
773115fd5f9334855b138323b74ca572695208a0
maybe it will work now and not break test suite?
Joey Hess [Thu, 30 Jan 2025 20:51:42 +0000 (16:51 -0400)]
fix truncateFilePath edge case on windows
If the filepath starts with something that is not valid utf-8, it would
have returned "". And if the filepath was all non-valid utf-8, it would
also return "".
Joey Hess [Thu, 30 Jan 2025 20:33:36 +0000 (16:33 -0400)]
Merge branch 'master' of ssh://git-annex.branchable.com
Joey Hess [Thu, 30 Jan 2025 20:31:49 +0000 (16:31 -0400)]
try fixing windows test suite
Test suite is failing in windows in conflict resolution tests, where the
automatic conflict resolution adds in a .variant file. On windows, those
files are somehow missing. I don't understand why, and the test failures
only happen on appveyor and not in a local windows VM.
So, since replaceFile was recently changed to remove a windows specific
ifdef, put it back, to see if that is somehow causing these failures.
jnkl [Thu, 30 Jan 2025 19:59:09 +0000 (19:59 +0000)]
Added a comment
Joey Hess [Thu, 30 Jan 2025 19:52:31 +0000 (15:52 -0400)]
Merge branch 'master' of ssh://git-annex.branchable.com
Joey Hess [Thu, 30 Jan 2025 19:46:32 +0000 (15:46 -0400)]
more OsPath conversion
Sponsored-by: Jack Hill
luciusf [Thu, 30 Jan 2025 19:17:58 +0000 (19:17 +0000)]
Added a comment
Joey Hess [Thu, 30 Jan 2025 19:07:17 +0000 (15:07 -0400)]
Merge branch 'master' into ospath
Joey Hess [Thu, 30 Jan 2025 19:06:37 +0000 (15:06 -0400)]
update
Joey Hess [Thu, 30 Jan 2025 19:06:05 +0000 (15:06 -0400)]
Merge branch 'master' into ospath
Joey Hess [Thu, 30 Jan 2025 19:05:18 +0000 (15:05 -0400)]
Merge branch 'ospath-mk1'
Joey Hess [Thu, 30 Jan 2025 19:03:47 +0000 (15:03 -0400)]
Merge branch 'master' of ssh://git-annex.branchable.com
Joey Hess [Thu, 30 Jan 2025 19:02:59 +0000 (15:02 -0400)]
update appveyor cache directory
With old:
Cache entry not found: C:\projects\git-annex\Users\appveyor\.stack
I think fixing this will result in caching preventing a full rebuild of
git-annex each time.
Joey Hess [Thu, 30 Jan 2025 18:57:51 +0000 (14:57 -0400)]
response
Joey Hess [Thu, 30 Jan 2025 18:52:41 +0000 (14:52 -0400)]
avoid build warning
An odd one, it complained about security_attributes being defined but
not used, but it was used..
jnkl [Thu, 30 Jan 2025 18:52:14 +0000 (18:52 +0000)]
Added a comment
Joey Hess [Thu, 30 Jan 2025 18:49:38 +0000 (14:49 -0400)]
avoid build warnings on windows
Joey Hess [Thu, 30 Jan 2025 18:39:05 +0000 (14:39 -0400)]
Merge branch 'master' of ssh://git-annex.branchable.com
jnkl [Thu, 30 Jan 2025 18:35:55 +0000 (18:35 +0000)]
Joey Hess [Thu, 30 Jan 2025 18:34:21 +0000 (14:34 -0400)]
bring back OsPath changes
I hope that the windows test suite failure on appveyor was fixed by
updating to a newer windows there. I have not been able to reproduce
that failure in a windows 11 VM run locally.
Joey Hess [Thu, 30 Jan 2025 18:33:08 +0000 (14:33 -0400)]
Merge branch 'ospath-mk1' into ospath
Joey Hess [Thu, 30 Jan 2025 18:32:44 +0000 (14:32 -0400)]
Revert "disable OsPath build flag on windows for now"
This reverts commit
55cf9ce28fe1c8a4ee64f1843cd3a88e85bcbf35.
Problem was fixed by commit
c1e90767daeff7557e047ea4229d83c4e78f9f12
Joey Hess [Thu, 30 Jan 2025 18:23:00 +0000 (14:23 -0400)]
fix FileIO openTempFile on Windows
When an UNC-style path is passed into openTempFile, the returned file
starts with that same style of path. Which can cause problems, eg piping
that filename to git failed. So, convert the output filename to be
relative to the input temp directory.
Joey Hess [Thu, 30 Jan 2025 18:23:00 +0000 (14:23 -0400)]
fix FileIO openTempFile on Windows
When an UNC-style path is passed into openTempFile, the returned file
starts with that same style of path. Which can cause problems, eg piping
that filename to git failed. So, convert the output filename to be
relative to the input temp directory.
Joey Hess [Thu, 30 Jan 2025 17:25:49 +0000 (13:25 -0400)]
Merge branch 'master' of ssh://git-annex.branchable.com
Joey Hess [Thu, 30 Jan 2025 17:24:51 +0000 (13:24 -0400)]
switch appveyor windows build to newer version
matrss [Thu, 30 Jan 2025 14:50:58 +0000 (14:50 +0000)]
dmcardle [Thu, 30 Jan 2025 13:56:30 +0000 (13:56 +0000)]
Added a comment
nobodyinperson [Thu, 30 Jan 2025 12:59:00 +0000 (12:59 +0000)]
Joey Hess [Wed, 29 Jan 2025 23:05:37 +0000 (19:05 -0400)]
close
Joey Hess [Wed, 29 Jan 2025 23:04:13 +0000 (19:04 -0400)]
document a SNAFU
Joey Hess [Wed, 29 Jan 2025 22:59:09 +0000 (18:59 -0400)]
throwing away a week's work
This was an attempt at continuing the RawFilePath transition into an
OsPath transition. Unforunately, it had multiple test suite failures on
windows. Debugging those seems that it would be more work than the
minor optimisation value of this.
Joey Hess [Wed, 29 Jan 2025 22:57:25 +0000 (18:57 -0400)]
merge in doc changes from master
Joey Hess [Wed, 29 Jan 2025 22:48:02 +0000 (18:48 -0400)]
Merge branch 'master' into ospath
Joey Hess [Wed, 29 Jan 2025 22:12:00 +0000 (18:12 -0400)]
fix liuxstandalone build
Joey Hess [Wed, 29 Jan 2025 21:22:21 +0000 (17:22 -0400)]
disable OsPath build flag on windows for now
Test suite failure looks like this:
fatal: could not open '\\?\C:\Users\appveyor\AppData\Local\Temp\1\hash-
cc81b41d-dfda-4ae8-904b-
b531742443cc' for reading: No such file or directory
fatal: could not open '\\?\C:\Users\appveyor\AppData\Local\Temp\1\hash-
cc81b41d-dfda-4ae8-904b-
b531742443cc' for reading: No such file or directory
fatal: could not open '\\?\C:\Users\appveyor\AppData\Local\Temp\1\hash-
cc81b41d-dfda-4ae8-904b-
b531742443cc' for reading: No such file or directory
fatal: could not open '\\?\C:\Users\appveyor\AppData\Local\Temp\1\hash-
cc81b41d-dfda-4ae8-904b-
b531742443cc' for reading: No such file or directory
fatal: could not open '\\?\C:\Users\appveyor\AppData\Local\Temp\1\hash-
cc81b41d-dfda-4ae8-904b-
b531742443cc' for reading: No such file or directory
fatal: could not open '\\?\C:\Users\appveyor\AppData\Local\Temp\1\hash-
cc81b41d-dfda-4ae8-904b-
b531742443cc' for reading: No such file or directory
fatal: could not open '\\?\C:\Users\appveyor\AppData\Local\Temp\1\hash-
cc81b41d-dfda-4ae8-904b-
b531742443cc' for reading: No such file or directory
fatal: could not open '\\?\C:\Users\appveyor\AppData\Local\Temp\1\hash-
cc81b41d-dfda-4ae8-904b-
b531742443cc' for reading: No such file or directory
fatal: could not open '\\?\C:\Users\appveyor\AppData\Local\Temp\1\hash-
cc81b41d-dfda-4ae8-904b-
b531742443cc' for reading: No such file or directory
fatal: could not open '\\?\C:\Users\appveyor\AppData\Local\Temp\1\hash-
cc81b41d-dfda-4ae8-904b-
b531742443cc' for reading: No such file or directory
fatal: could not open '\\?\C:\Users\appveyor\AppData\Local\Temp\1\hash-
cc81b41d-dfda-4ae8-904b-
b531742443cc' for reading: No such file or directory
git-annex: fd:4: Data.ByteString.hGetLine: end of file
git-annex: user error (git ["--git-dir=.git","--work-tree=.","--literal-pathspecs","hash-object","-w","--no-filters","--stdin-paths"] exited 128)
This is apparently in Git.HashObject, and probably in hashBlob, which uses a
temp file with a name starting with "hash", but I have not been able to tell
what's wrong.
I don't understand where the "\\?" path prefix (windows UNC-style path)
is coming from in the path that gets fed into git hash-file, or why git
hash-file can't open the file.
Joey Hess [Wed, 29 Jan 2025 21:19:01 +0000 (17:19 -0400)]
remove temp debugging code
Joey Hess [Wed, 29 Jan 2025 20:37:54 +0000 (16:37 -0400)]
debug test suite crash on windows
Joey Hess [Wed, 29 Jan 2025 20:24:51 +0000 (16:24 -0400)]
more OsPath conversion
Sponsored-by: Kevin Mueller
Joey Hess [Wed, 29 Jan 2025 19:37:19 +0000 (15:37 -0400)]
Merge branch 'master' into ospath
Joey Hess [Wed, 29 Jan 2025 19:36:41 +0000 (15:36 -0400)]
fix windows build
Joey Hess [Wed, 29 Jan 2025 18:59:00 +0000 (14:59 -0400)]
windows build fix
Joey Hess [Wed, 29 Jan 2025 18:52:20 +0000 (14:52 -0400)]
fix windows build and clarify comment
Joey Hess [Wed, 29 Jan 2025 18:24:35 +0000 (14:24 -0400)]
Merge branch 'master' into ospath
Joey Hess [Wed, 29 Jan 2025 18:19:25 +0000 (14:19 -0400)]
fix fromOsPath on windows
Same reasons as
9c9baf7c6581235643661b94f70f76f8a10ae60e
Joey Hess [Wed, 29 Jan 2025 18:06:54 +0000 (14:06 -0400)]
fix toOsPath on windows
After recent changes to use OsPath, test suite fails on windows with:
Exception: Uneven number of bytes: 5. This is not a Word16 bytestream.
Hopefully this fixes it. The innefficiency of the conversion is
unfortunate.
Joey Hess [Wed, 29 Jan 2025 16:06:22 +0000 (12:06 -0400)]
response
Joey Hess [Wed, 29 Jan 2025 15:53:20 +0000 (11:53 -0400)]
more OsPath conversion
Sponsored-by: Nicholas Golder-Manning
dmcardle [Wed, 29 Jan 2025 14:44:38 +0000 (14:44 +0000)]
Added a comment
matrss [Wed, 29 Jan 2025 10:13:59 +0000 (10:13 +0000)]
Added a comment
matrss [Wed, 29 Jan 2025 09:56:13 +0000 (09:56 +0000)]
Added a comment
Atemu [Tue, 28 Jan 2025 21:57:42 +0000 (21:57 +0000)]
Added a comment
jnkl [Tue, 28 Jan 2025 21:32:18 +0000 (21:32 +0000)]
jnkl [Tue, 28 Jan 2025 21:20:17 +0000 (21:20 +0000)]
Added a comment
Joey Hess [Tue, 28 Jan 2025 20:31:19 +0000 (16:31 -0400)]
more OsPath conversion
Sponsored-by: Luke T. Shumaker
Joey Hess [Tue, 28 Jan 2025 20:00:09 +0000 (16:00 -0400)]
Merge branch 'master' of ssh://git-annex.branchable.com
Joey Hess [Tue, 28 Jan 2025 20:00:03 +0000 (16:00 -0400)]
Merge branch 'master' into ospath
Joey Hess [Tue, 28 Jan 2025 19:59:45 +0000 (15:59 -0400)]
windows build fix
and a little more bonus RawFilePath conversion
Joey Hess [Tue, 28 Jan 2025 19:46:00 +0000 (15:46 -0400)]
more OsPath conversion
Sponsored-by: mycroft
Joey Hess [Tue, 28 Jan 2025 19:29:58 +0000 (15:29 -0400)]
Merge /home/joey/tmp/git-annex into ospath